<?php
/**
 *
 * PHP 5
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.View.Layouts
 * @since         CakePHP(tm) v 0.10.0.1076
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
$cakeDescription = __d('cake_dev', 'My Money: the money management tool by QuangNV');
?>
<!DOCTYPE html>
<html>
	<head>
		<?php echo $this->Html->charset(); ?>
		<title>
			<?php echo $cakeDescription ?>:
			<?php echo $title_for_layout; ?>
		</title>
		<?php
		echo $this->Html->meta('icon');

		echo $this->Html->css(array(
			'bootstrap.min.css',
			'image-picker',
			'style',
		));
		echo $this->Html->script(array('jquery-1.10.2.min', 'bootstrap.min', 'image-picker.min'));

		echo $this->fetch('meta');
		echo $this->fetch('css');
		echo $this->fetch('script');
		?>
	</head>
	<body>
		<div id="container" class="container">
			<div id="header">
				<div class="container">
					<div class="navbar navbar-default" role="navigation">
						<div class="navbar-header"><span class="navbar-brand">MyMoney</span></div>
						<div class="collapse navbar-collapse">
							<ul class="nav navbar-nav">
								<li<?php
								if ('transactions' === strtolower($this->request->params['controller'])) {
									echo ' class="active"';
								}
								?>>
										<?php
										echo $this->Html->link('Nhật ký', array('controller' => 'transactions', 'action' => 'index'));
										?>
								</li>
								<li<?php
								if ('accounts' === strtolower($this->request->params['controller'])) {
									echo ' class="active"';
								}
								?>>
										<?php
										echo $this->Html->link('Quản lý tài khoản', array('controller' => 'accounts', 'action' => 'index'));
										?>
								</li>
								<li<?php
								if ('categories' === strtolower($this->request->params['controller'])) {
									echo ' class="active"';
								}
								?>>
										<?php
										echo $this->Html->link('Quản lý danh mục', array('controller' => 'categories', 'action' => 'index'));
										?>
								</li>
							</ul>
						</div>
					</div>
				</div>
			</div>
			<div id="content" class="container">

				<?php echo $this->Session->flash(); ?>

				<?php echo $this->fetch('content'); ?>
			</div>
			<div id="footer">

				<div class="navbar navbar-default navbar-fixed-bottom" role="navigation">
					<div class="container">
						<p class="navbar-text pull-right">MyMoney by QuangNV</p>
					</div>
				</div>

			</div>
		</div>
		<div id="busy-overlay"></div>
		<?php //echo $this->element('sql_dump');    ?>
		<?php echo $this->Js->writeBuffer(); // Write cached scripts   ?>
		<script>
			$(document).ajaxStart(function() {
				$("#busy-overlay").width($(window).width());
				$("#busy-overlay").height($(window).height());
				$("#busy-overlay").show();
			});
			$(document).ajaxStop(function() {
				$("#busy-overlay").hide();
			});
			$(window).resize(function() {
				if ($("#busy-overlay").is(':visible')) {
					$("#busy-overlay").width($(window).width());
					$("#busy-overlay").height($(window).height());
				}
			});
		</script>
	</body>
</html>
